
#include "lvgl.h"
#include "img_def.h"
#include "lv_common_function.h"


void lv_user_sqstatck_init(SeqStack *SS)
{
    SS->topidx = 0;
}


uint8_t lv_user_get_sqstatck_top(SeqStack *SS,uint8_t *top)
{
    if(SS->topidx == 0)
        return 0;
    // --SS->topidx;
    *top = SS->Data[SS->topidx-1];
    // SS->Data[SS->topidx] = 0;
    return 1;
}


//error:0,success:1;
uint8_t lv_user_sqstatck_push(SeqStack *SS,uint8_t elem)
{
    if(SS->topidx >= (SQ_STACK_MAXSIZE-1))
        return 0;

    SS->Data[SS->topidx++] = elem;
    return 1;
}


//error:0,success:1;
uint8_t lv_user_sqstatck_pop(SeqStack *SS,uint8_t *elem)
{
    if(SS->topidx == 0)
        return 0;
    --SS->topidx;
    *elem = SS->Data[SS->topidx];
    SS->Data[SS->topidx] = 0;
    return 1;
}

